﻿/*

  The contents of this file are subject to the Mozilla Public License Version
  1.1 (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at 
  
           http://www.mozilla.org/MPL/ 
  
  Software distributed under the License is distributed on an "AS IS" basis,
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  for the specific language governing rights and limitations under the License. 
  
  The Original Code is PEGAS Framework.
  
  The Initial Developer of the Original Code is
  ALCARAZ Marc (aka eKameleon)  <ekameleon@gmail.com>.
  Portions created by the Initial Developer are Copyright (C) 2004-2009
  the Initial Developer. All Rights Reserved.
  
  Contributor(s) :
  
*/

package examples 
{    import pegas.draw.Align;
    import pegas.draw.FillStyle;
    import pegas.draw.LineStyle;
    import pegas.draw.Pen;
    import pegas.draw.RectanglePen;
    import pegas.transitions.TweenLite;
    import pegas.transitions.easing.Bounce;
    
    import system.events.ActionEvent;
    
    import flash.display.Shape;
    import flash.display.Sprite;
    
    public class ExampleTweenLite01 extends Sprite
    {        public function ExampleTweenLite01()
        {
            /// build and draw the shape
            
            var shape:Shape = new Shape() ;
            var pen:Pen     = new RectanglePen( shape ) ;
            
            pen.fill = new FillStyle(0xFFFFFF) ;
            pen.line = new LineStyle(1,0x999999) ;
            pen.draw(0,0,32,32,Align.CENTER) ;
            
            shape.x = 50 ;
            shape.y = 50 ;
            
            addChild( shape ) ;
            
            // test the continueTo() method
            
            tween = new TweenLite ( shape, "x", Bounce.easeOut, shape.x, 600, 2, true ) ;
            
            tween.addEventListener( ActionEvent.FINISH , yoyo ) ;
            
            tween.run() ;
        }
        
        public var tween:TweenLite ;
        
        public function yoyo( e:ActionEvent ):void
        {
            trace( "continueTo(100,3)" ) ;
            tween.removeEventListener( ActionEvent.FINISH , yoyo ) ;
            tween.continueTo( 100 , 3 ) ;
        }
    }
    }